package con.shopping.entity;

import lombok.AllArgsConstructor;

import java.util.Date;

/**
 * @author ：河神
 * @date ：Created in 2022/2/14 8:22 下午
 */
public class ActiveTime {

    private Date startDate;
    private Date endDate;

    public ActiveTime(Date startDate, Date endDate) {
        if (startDate==null||endDate==null){
            throw new RuntimeException("活动时间错误！");
        }
        this.startDate = startDate;
        this.endDate = endDate;
    }

    public boolean effective(Date date){
        return startDate.compareTo(date)<0&&endDate.compareTo(date)>0;
    }

}
